local Lua__haqi = fk.CreateSkill {

  name = "Lua__haqi",

  tags = { Skill.Compulsory },

}

Fk:loadTranslationTable{
    ["Lua__haqi"] = "哈气",
    [":Lua__haqi"] = "锁定技，你受到伤害后，令当前回合角色立即流失一点体力并结束出牌阶段。然后若该角色为你，你将体力值与手牌数均调整至上限。",
}

Lua__haqi:addEffect(fk.Damaged, {
    anim_type = "defensive",
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(Lua__haqi.name)
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        room:loseHp(room.current, 1,Lua__haqi.name)
        if room.current.phase == Player.Play then
            room.current:endPlayPhase()
        end
        -- 如果当前回合角色是自己，调整体力值和手牌
        if room.current == player then
            -- 调整体力值
            if player.hp < player.maxHp then
                room:recover({
                    who = player,
                    num = player.maxHp - player.hp,
                    recoverBy = player,
                    skillName = Lua__haqi.name
                })
            end
            -- 调整手牌
            local diff = player:getMaxCards() - #player:getCardIds(Player.Hand)
            if diff > 0 then
                player:drawCards(diff, Lua__haqi.name)
            end
        end
    end,
})

return Lua__haqi